package com.servlet;

import com.dao.imp.FindOrder;
import net.sf.json.JSONObject;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;

/**
 * @author Mathison
 * @Title: ${NAME}
 * @Package: ${PACKAGE_NAME}
 * @Description: TODO
 * @date 2021/12/3 13:49
 **/

@WebServlet(name = "GetTotalOrderNumberServelt", value = "/GetTotalOrderNumberServelt")
public class GetTotalOrderNumberServelt extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        this.doPost(request, response);
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        int orderNumber = FindOrder.getOrderNumber();

//        System.out.println(orderNumber);
        JSONObject json = JSONObject.fromObject("{total:"+orderNumber+"}");

//        System.out.println(json);
        response.getWriter().print(json);
    }
}
